package com.bjpowernode.springboot.utils;

import org.springframework.stereotype.Component;

import java.util.regex.Pattern;

/**
 * 定义正则工具类
 */
@SuppressWarnings("all")
@Component
public class RegexUtil {
    static final String ALL_NUMS = "[0-9]*"; // 全部是数字
    static final String ALL_ALPHA = "[a-zA-Z]*"; // 全部是字母
    static final String COMPLEX = "[0-9]+[a-zA-Z]+"; // 数字和字母的混合模式，至少都包含1个 ，+ 贪婪匹配，至少出现一次

    // 判断给定的字符串是否在指定的长度范围之内
    public static boolean judgeLen(String s, int lowbound, int uppbound) {
        if (s == null || "".equals(s)) return false;
        int n = s.length();
        return n >= lowbound && n <= uppbound;
    }


    public static String getAllNums() {
        return ALL_NUMS;
    }

    public static String getAllAlpha() {
        return ALL_ALPHA;
    }

    public static String getCOMPLEX() {
        return COMPLEX;
    }


}
